#include "mainwindow.h"
#include <QApplication>
#include "logindialog.h"
#include <QString>
#include <QObject>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    int exitCode = 0;
    do{
        QDir dir;
        if(!dir.exists(qApp->applicationDirPath()+"/data/"))//判断需要创建的文件夹是否存在
        {
            dir.mkdir(qApp->applicationDirPath()+"/data/"); //创建文件夹
        }
        MainWindow *w = new MainWindow(); //主界面
        LoginDialog *login = new LoginDialog(); //登陆界面
        QObject::connect(login, SIGNAL(packageChanged(QString)), w, SLOT(setPackage(QString)),Qt::UniqueConnection);
        if(login->exec()==QDialog::Accepted){
            w->show();
            exitCode  = a.exec();
        }else{
            return 0;
        }
    }while( exitCode  == 888 );
    return 0;
}

